const myaql = require('mysql');

let pools = myaql.createPool({
    host:'localhost',
    //'8.130.83.180',//连接本地物理机
    password:'root',
    //'Smy327511',
    user:"root",
    database:"mydb"//连接数据库
})

function excute(sqlString,condition){
    let promise = new Promise((resolve,reject)=>{
        pools.query(sqlString,condition,function(error,result,fields){
            if(error){
                reject(error)
            }
            else{
                resolve(result)
            }
        })
    })
   return promise;
}

module.exports={
    EXCUTE:excute
}